#ifndef _JOB_H_
#define _JOB_H_

#include "task.h"
#include <string>

class Job {
	private:
		const char *name;
		Task **tasks;
		int numberOfTasks;

		/*Througput of the application while processing data*/
		long double inputData_tpt;
		long double outputData_tpt;

	public:
		/*Constructor*/
		Job(const char *name, long double inputData_tpt, long double outputData_tpt);
		/*Destructor*/
		 ~Job();
		/*Add a Task to the job. Necessary to call after the constructor*/
		void addTask(long double inputDataSize, long double outputDataSize);
		/*Replicate a given Task*/
		void createReplicaOfTask(Task *taskToReplicate, long double replicaTransferCost);
		void createReplicaOfTask(int taskIndex, long double replicaTransferCost);
		/*Return a task of the job given its index*/
		Task *getTaskByIndex(int taskIndex);
		/*Get task by Name*/
		Task *getTaskByName(const char *task_name);
		/*return the number of tasks*/
		int getNumberOfTasks();
		/*Get the througput of input data*/
		long double getInputTpt();
		/*Get the througput of output data*/
		long double getOutputTpt();		
		/*get the job name*/		
		const char* getName();
		/*Restart the Job by reseting its tasks*/
		void resetTasks();
		
		/*return true if there is at least one task not scheduled yet*/
		bool hasTaskNotScheduled();

		/*return true if there is at least one task not finished*/
		bool hasTaskNotFinished();
		
		/*Return the smallest number of replicas (replication Degree)*/
		int getMinReplicationDegree();
		
		/*Delete all tasks*/
		void deleteAllTasks();
};

#endif //_JOB_H_
